<!--tvm票款差异协查-->
<template>
  <div class="fenQianXiangCengjiCYDXC HuikuiInfo el-card is-always-shadow el-card__body">
    <el-dialog
      title="操作回馈信息"
      :visible.sync="dialogVisible"
      @close="closed"
      width="950px">
      <div style="line-height: 40px;background-color: #fcf7f7;padding-left: 15px">
        <span>线路：</span><span>{{getLineName(formData.lineCode)}}</span>
        <span style="margin-left: 20px">站点：</span><span>{{getStationName(formData.lineCode,formData.stationCode)}}</span>
        <span style="margin-left: 20px">TVM编号：</span><span>{{formData.tvmOrder}}</span>
        <span style="margin-left: 20px">钱箱类型：</span><span>{{getQianxiangType(formData.tvmMoneyType)}}</span>
        <span style="margin-left: 20px">钱箱编号：</span><span>{{formData.tvmMoneyOrder}}</span>
      </div>
      <avue-form v-if="isReload" class="fenQianXiangCengjiCYDXCForm" :option="option" v-model="formData" @submit="handleSubmit">
        <template slot-scope="{row}" slot="type">
          <span>{{row.type}}</span>
        </template>
        <template slot-scope="{row}" slot="saleAmount">
          <span>{{fenExYuangettoFixed(row,'saleAmount')}}</span>
        </template>
        <template slot-scope="{row}" slot="saleAmountCY">
          <span>{{fenExYuangettoFixed(row,'saleAmountCY')}}</span>
        </template>
        <template slot-scope="{row}" slot="replySystemAmount">
          <span>{{fenExYuangettoFixed(row,'replySystemAmount')}}</span>
        </template>
        <template slot-scope="scope" slot="menuForm">
          <el-button type="primary" @click="handleSubmit" v-if="showType==3">一键替换</el-button>
          <el-button  @click="$parent.isShowDia=false" >返回</el-button>
        </template>
      </avue-form>
    </el-dialog>
  </div>
</template>


<script>
  import {clearSelect, electromeReasons, qianxiangType,fenExYuangettoFixed,
    getQianxiangType,getLineName,getStationName
  } from "../../../../../../../api/subwayRat/commonCheck";
  import {
    cols1, cols2, getMondifyData1, getMondifyData2, replaceSwAuTvmBoxAmountDifference
  } from "../../../../../../../api/subwayRat/TVMRevenueVarianceAudit.TvmChaYiDXC/tvmCengJiCYXC/tvmXianJinCengJiCYDXY/fenQianXiangCengJiCYDXC";

  export default {
    components:{
    },
    data() {
      return {
        isReload:true,
        //1编辑，2添加，3预览
        showType:1,
        replaceStatus:0,
        dialogVisible:true,
        formData:{
        },
        option:{

        }
    }
    },
    created() {
    },
    methods: {
      getQianxiangType,getLineName,getStationName,
      fenExYuangettoFixed,
      handleSubmit(){
        replaceSwAuTvmBoxAmountDifference({ids:this.formData.id,tableDataSource:2}).then(res=>{
          if(res.data.code==0){
            this.$message.success("操作成功！");
            this.closed();
            this.$parent.getList();
            clearSelect(this.$parent.$refs.TvmTicketCYXC)
          }else{
            this.$message.error(res.data.msg);
          }
        })
      },
      recallShow(id,row,showType,replaceStatus){
        this.showType=showType;
        this.replaceStatus=replaceStatus;
        // row.jdReplyReason=row.jdReplyReason;//转数字
        // row.qfReplyReason=row.qfReplyReason;//转数字
        this.getOption();
        this.formData={};
        Object.assign(this.formData,row);

        let mondify1=getMondifyData1(row);
        let mondify2=getMondifyData2(row);
        this.formData.dynamic=mondify1;
        this.formData.dynamic2=mondify2;
        // getSwAuTvmCashAmountHierarchyDifferenceList({relationid:id}).then((res)=>{
        //   if(res.data.code!=0){
        //       this.$message.error("获取数据失败！");
        //       return;
        //   }
        //   Object.assign(this.formData,res.data.data[0]); //
        //   console.log(this.formData)
        // }).catch((e)=>{
        //   this.$message.error("获取数据失败！");
        // })
      },
      closed(){
        this.$parent.isShowDia=false;
      },
      getOption(){
        let group1={
          icon:'',
          sortable:true,
          label: '层级差异信息',
          // collapse:false,
          prop: 'group1',
          indexLabel:"#",
          column: [{
            label: '',
            prop: 'dynamic',
            type: 'dynamic',
            span:24,
            children: {
              addBtn:false,
              delBtn:false,
              sortable:true,
              index:false,
              indexLabel:"#",
              align: 'center',
              headerAlign: 'center',
              column: cols1
            }
          }
          ]
        };
        let group2={
          icon:'',
          sortable:true,
          label: '层级差异协查与回馈',
          // collapse:false,
          prop: 'group2',
          indexLabel:"#",
          column: [{
            label: '',
            prop: 'dynamic2',
            type: 'dynamic',
            span:24,
            children: {
              addBtn:false,
              delBtn:false,
              sortable:true,
              index:false,
              indexLabel:"#",
              align: 'center',
              headerAlign: 'center',
              column: cols2
            }
          }
          ]
        };

        let group3={
          icon:'',
          label: '',
          // collapse:false,
          prop: 'group3',
          column: [{
            label: '归属机电专业回馈差异原因',
            prop: 'jdReplyReason',
            labelWidth:200,
            type:'select',
            dicData:electromeReasons(),
            disabled: this.showType==3 //&& this.replaceStatus==1,
          },
            {
              label: '机电专业详细描述',
              prop: 'jdReplyDetail',
              type: 'textarea',
              labelWidth:150,
              disabled: this.showType==3 //&& this.replaceStatus==1
            },
            {
              label: '清分管理人员回馈差异原因',
              prop: 'qfReplyReason',
              labelWidth:200,
              dicData:electromeReasons(),
              type:'select',
              disabled: this.showType==3 //&& this.replaceStatus==1,
            },
            {
              label: '清分管理人员详细描述',
              prop: 'qfReplyDetail',
              type: 'textarea',
              labelWidth:150,
              disabled: this.showType==3 //&& this.replaceStatus==1 //回馈过的和替换过的禁止修改
            },
          ]
        };

        this.option={
          submitBtn:false,
          emptyBtn:false,
          span:12,
          group:[]
        } ;
        this.option.group.push(group1);
        if(this.showType==3){
          this.option.group.push(group2);
          this.option.group.push(group3);
        }else if(this.showType!=3){
        }
        this.isReload=false;
        this.$nextTick(()=>{
          this.isReload=true;
        })
      }
    },
    mounted() {

    }
  }
</script>
<style lang="scss">
  .fenQianXiangCengjiCYDXC{
    .fenQianXiangCengjiCYDXCForm{

      .avue-group[index='1']{
        .el-form-item{
          min-width: 450px;
        }
        .avue-form__row{
          width: 100%;
        }
      }
      .avue-group[index='2']{
        .el-form-item{
          min-width: 450px;
        }
        .avue-form__row{
          width: 100%;
        }
      }
    }
  }

</style>
